Repository navigation
fix(libkernel): fail lseek on a pipe with ESPIPE on Windows - #4672
Merged
adriadam10 merged 1 commit intoOct 13, 2026
Merged
Conversation
milescoviello
force-pushed
the
carry/lseek-pipe-windows-4670
branch
from
October 12, 2026 18:33
5491464 to
61fbec8
Compare
This was referenced Oct 12, 2026
10 tasks done
Collaborator
|
Checked on the PR merged onto current main: scoped build and ctest (147 tests, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes #4670. Carries @DavidSamir's fix branch from that issue (
DavidSamir:fix/libkernel-lseek-pipe-windows,32f49a97), keeping the commit and its authorship; it is cherry-picked onto currentmain, with the declaration conflict #4536 left inGuestFilesystem.cppresolved by keeping both.On Windows,
lseekandsceKernelLseeksucceeded on a pipe and returned a position, and withSEEK_ENDthe number of bytes waiting in it, becauseNativeLseekcalls_lseeki64and Windows accepts a position on a pipe handle. FreeBSD'slseek(2)fails withESPIPEwhen the descriptor "is associated with a pipe, socket, or FIFO", and the Linux build already does. WindowsNativeLseeknow makes the same_lseeki64call, so a closed or invalid descriptor fails as before, and then returnsESPIPEwhen the handle's type isFILE_TYPE_PIPE. Linux is unchanged.guest_filesystemchecks both ends of a pipe:lseekfails with errno 29 andsceKernelLseekreturns0x8002001DforSEEK_SET,SEEK_CURandSEEK_END, the bytes written before are read back unchanged, and aftercloselseekfails with errno 9.Tested
main'sOpen.cppthe new checks fail and with the fixguest_filesystempasses 5/5; a 97-operation file probe differs in one line,lseekon a pipe; eleven catalog titles end the same way with both sets of libraries; fullctest973/973. About 0.1 µs is added to each seek by theGetFileTypecall.main9df7746 after fix(libkernel): keep sceKernelDebugOutText off a redirected guest stderr #4536 (which added a declaration next to this one inGuestFilesystem.cpp; both are kept).guest_filesystem,guest_kernel_fcntl,guest_dupandguest_pollpass, and all 310guest_*tests pass. The new checks also pass withmain'sOpen.cpp, as expected since only the Windows path changes. I could not run Windows myself.tools/check_conventions.py --base upstream/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code